<template>
	<view class="padding flex flex-direction">
		<view class="cu-form-group">
			<view class="title">登录账号</view>
			<input v-model="form.loginId"></input>
		</view>
		<view class="cu-form-group">
			<view class="title">登录密码</view>
			<input type="password" v-model="form.loginPass"></input>
		</view>
		<button class="cu-btn bg-blue lg" @click="clickLogin">登录</button>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				form:{
					loginId:'',
					loginPass:''
				}
			};
		},
		methods:{
			clickLogin(){
				this.$u.api.admin_checkLogin(this.form).then(data => {
					uni.setStorageSync('admin_id',data.admin_id);
					uni.setStorageSync('admin_token',data.admin_token);
					console.log('登录成功，开始跳转页面');
					uni.navigateTo({
						url:'/pages/admin/main'
					})
				})
			}
		}
	}
</script>

<style lang="scss">

</style>
